package com.opdar.athena.messages;

import com.opdar.athena.base.Message;
import java.nio.ByteBuffer;

/**
 * Created by shiju on 2017/6/28.
 */
public class TransferMessage extends Message {

    private String messageId;
    private String token;

    public TransferMessage(byte[] body) {
        ByteBuffer byteBuffer = ByteBuffer.wrap(body);
        int messageLen = byteBuffer.getInt();
        byte[] messageData = new byte[messageLen];
        byteBuffer.get(messageData);
        messageId = new String(messageData);
        int tokenLen = byteBuffer.getInt();
        byte[] tokenData = new byte[tokenLen];
        byteBuffer.get(tokenData);
        token = new String(tokenData);
    }

    public String getMessageId() {
        return messageId;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @Override
    public String command() {
        return "Transfer";
    }
}
